<script setup lang="ts">
import zhCN from 'ant-design-vue/es/locale/zh_CN'
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
import { onMounted } from 'vue'
import { ConfigProvider } from 'ant-design-vue'

dayjs.locale('zh-cn')

window.electron.ipcRenderer.on('themeToggle', (_, theme) => {
  document.documentElement.setAttribute('data-theme', theme)
})

onMounted(() => {
  const theme = localStorage.getItem('theme')
  theme
    ? document.documentElement.setAttribute('data-theme', theme)
    : document.documentElement.setAttribute('data-theme', 'light')
})
</script>

<template>
  <ConfigProvider :locale="zhCN">
    <router-view></router-view>
  </ConfigProvider>
</template>

<style scoped>
.home {
  width: 100%;
  height: 100%;
  display: flex;
}
</style>
